﻿<template>
    <el-dialog
        :title="titleMap[mode]"
        v-model="visible"
        :width="1000"
        destroy-on-close
        @closed="$emit('closed')"
    >
        <el-form
            :model="entityObj"
            :rules="rules"
            :disabled="mode == 'Show'"
            ref="dialogForm"
            label-width="100px"
        >
            <el-row>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="采购单位编号" >
                        <el-input v-model="entityObj.purchaseUnityCode" />
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="采购单位名称" >
                        <el-input v-model="entityObj.purchaseUnityName" />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="采购单位全称" >
                        <el-input v-model="entityObj.purchaseUnityName" />
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="电子账户" >
                        <el-input v-model="entityObj.electronicAccount" />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="联系人" >
                        <el-input v-model="entityObj.realName" />
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="联系电话" >
                        <el-input v-model="entityObj.mobile" />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="联系地址" >
                        <el-input v-model="entityObj.address" />
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="状态" >
                        <el-input v-model="entityObj.statusDesc" />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="制单人" prop="crOrderId">
                        <el-select
                            placeholder="---请选择制单人---"
                            v-model="entityObj.crOrderId"
                            style="width: 300px"
                            disabled
                        >
                            <el-option label="---请选择---" value />
                            <el-option
                                v-for="item in optionsAccount"
                                :key="item.accountId"
                                :label="item.realName"
                                :value="item.accountId"
                            />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label-width="120px" label="对账人" prop="reconciliationId">
                        <el-select
                            placeholder="---请选择对账人---"
                            v-model="entityObj.reconciliationId"
                            style="width: 300px"
                            disabled
                        >
                            <el-option label="---请选择---" value />
                            <el-option
                                v-for="item in optionsAccount"
                                :key="item.accountId"
                                :label="item.realName"
                                :value="item.accountId"
                            />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label-width="120px" label="备注">
                        <el-input v-model="entityObj.remarks" type="textarea" :rows="2" />
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
    </el-dialog>
</template>

<script>
import tool from "@/utils/tool";
export default {
    emits: ["success", "closed"],
    data() {
        return {
            optionsAccount:[],
            mode: "Add",
            titleMap: {
                Add: "新增",
                Edit: "编辑",
                Show: "查看",
            },
            entityObj: {
            
            },
        };
    },
    methods: {
        //显示=
        open(mode = "Add") {
            this.mode = mode;
            this.visible = true;
            return this;
        },
        //表单注入数据
        async setData(data) {
            this.entityObj = {
                ...data,
            }; 
        },
        async initOptions() {
            try {
                var returnValue = await this.$API.auth.GetProcessApi.get(
                    "account/options",
                    { }
                );
                if (returnValue.status == 200) {
					this.optionsAccount=returnValue.response;
                } else {
                    this.$message.error("操作失败:" + returnValue.msg);
                }
            } catch (error) {
                this.loading = false;
                return false;
            }
        },
    },
    async mounted() {
        await this.initOptions();
    },
};
</script>

<style></style>
